package com.gxj.study.shopdemo.adapter;

import android.content.Context;
import android.net.Uri;

import com.facebook.drawee.view.SimpleDraweeView;
import com.gxj.study.shopdemo.R;
import com.gxj.study.shopdemo.bean.Wares;

import java.util.List;

/**
 * Created by 祥杰 on 2016/8/6.
 */

public class HWAdapter extends SimpleAdapter<Wares> {
    public HWAdapter(Context context, List<Wares> datas) {
        super( context,R.layout.template_hot_wares,datas);
    }

    public HWAdapter(Context context, int layoutResId, List<Wares> datas) {
        super(context, layoutResId, datas);
    }

    @Override
    protected void convert(BaseViewHolder viewHolder, Wares item) {
        SimpleDraweeView draweeView = (SimpleDraweeView) viewHolder.getView(R.id.drawee_view);
        draweeView.setImageURI(Uri.parse(item.getImgUrl()));
        viewHolder.getTextView(R.id.text_title).setText(item.getName());
        viewHolder.getTextView(R.id.text_price).setText("$" + item.getPrice());
    }
}
